<#include "/public/secfield.html">
<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<div class="row" style="height:100%;">
			<div class="col-lg-12" style="border-right:1px solid #e6e6e6;padding-right:0px;">
				<h1 class="site-h1" style="background-color:#FFFFFF;">
					联系人
					<span style="float:right;">
						<button class="layui-btn layui-btn-sm green" href="/apps/contacts/item/add.html?addtype=type" data-toggle="ajax" data-height="360" data-width="550" data-title="新建分类">
							新建分类
						</button>
						<button class="layui-btn layui-btn-sm green" href="/apps/contacts/item/add.html?addtype=item" data-toggle="ajax" data-height="360" data-width="550" data-title="新建项目">
							新建项目
						</button>
					</span>
				</h1>
				<div class="ukefu-scroll" style="overflow: hidden; outline: none;">
				<ul class="ukefu-contacts-menu">
					<li class="menu-dropdown">
						<a class="menu-dropdown-a" href="javascript:void(0);"> 
							<i class="layui-icon "></i> 
							<span class="text">公共联系人</span>
						</a>
						<i class="layui-icon " style="float:right;text-indent: 2em;"></i> 
						<div class="list page-list" <#if !ckind??> style="display: none;"</#if>>
							<div class="list-con crm-clearfix">
								<ul class="list-menu">
									<#if user?? && (user.roleAuthMap["A02_A01_A01"]?? || user.usertype == "0") >
										<li>
											<a <#if !ckind?? && !itemid??>class="cur"</#if> href="/apps/contacts/index.html" style="text-indent: 2em;">
												<i class="layui-icon"></i> 
												<span class="text">全部联系人</span>
											</a>
										</li>
									</#if>
									<#if user?? && (user.roleAuthMap["A02_A01_A02"]?? || user.usertype == "0") >
									<#if uKeFuDic['com.dic.contacts.ckind']??>
									<#list uKeFuDic['com.dic.contacts.ckind'] as dic>
										<li>
											<a <#if ckind?? && ckind==dic.id>class="cur"</#if>  href="/apps/contacts/index.html?ckind=${dic.id!''}" style="text-indent: 2em;">
												<i class="layui-icon">&#xe770;</i> 
												<span class="text">${dic.name!''}</span>
											</a>
										</li>
									</#list>
									</#if>
									</#if>
								</ul>
							</div>
						</div>
					</li>
				
					
					<#if contactsItemList?? && contactsItemList?size gt 0>
						<#list contactsItemList as contactsItem>
							<#if contactsItem.itemid?? && contactsItem.itemid==contactsItem.id>
								<li class="menu-dropdown">
									<a class="menu-dropdown-a" href="javascript:void(0)"> 
										<i class="layui-icon ">&#xe613;</i> 
										<span class="text">${contactsItem.name!''}</span>
									</a>
									<#assign icon=false>
									<#list contactsItemList as item2>
										<#if item2.parentid?? && item2.parentid==contactsItem.id>
										<#assign icon=true>
										<i class="layui-icon <#list contactsItemList as item2><#if item2.parentid?? && item2.parentid==contactsItem.id>menu-dropdown-a</#if><#break></#list>" style="float:right;text-indent: 2em;">&#xe602;</i> 
										<div class="list page-list" style="">
											<div class="list-con crm-clearfix">
												<ul class="list-menu">
													<#list contactsItemList as itemtype>
														<#if itemtype.parentid?? && itemtype.parentid==contactsItem.id>
															<li>
															<a <#if itemid?? && itemid==itemtype.id>class="cur"</#if>  href="/apps/contacts/index.html?itemid=${itemtype.id!''}" style="text-indent: 2em;">
																<i class="layui-icon">&#xe770;</i> 
																<span class="text">${itemtype.name!''}</span>
															</a>
															</li>
														</#if>
													</#list>
												</ul>
											</div>
										</div>
										<#break>
										</#if>
									</#list>
									<#if icon?? && icon==false><i class="layui-icon " style="float:right;font-size:20px;color: red;cursor: pointer;" onclick="top.layer.confirm('请确认是否删除该分类或项目？', {icon: 3, title:'提示'}, function(index){top.layer.close(index);if(confirm){location.href = '/apps/contacts/item/delete.html?itemid=${contactsItem.id!''}' ;}});">&#xe640;</i></#if>
								</li>
							</#if>
						</#list>
					</#if>
				</ul>
			</div>
			</div>
		</div>
	</div>
</div>
<div class="layui-body">
	<#include "/apps/business/contacts/include/head.html">
	<div class="layui-tab">
	  <div class="layui-tab-content" style="padding:0px;">
	    <div class="layui-tab-item layui-show">
			<div class="layui-side-scroll">
				<div class="row">
					<div class="col-lg-12">
						<h1 class="site-h1" >
						筛选条件
						</h1>
					</div>
				</div>
				<div class="row">
					<div class="col-lg-11">
						<form class="layui-form" name="search" action="/apps/contacts/quality/index.html?itemid=${itemid!''}&ckind=${ckind!''}&qualitystatus=${qualitystatus}" method="post">
						<#if itemid??><input type="hidden" name="itemid" value="${itemid!''}"></#if>
						<#if ckind??><input type="hidden" name="ckind" value="${ckind!''}"></#if>
		    			<#include "/apps/business/callcenter/service/include/search.html">
		    			</form>
					</div>
				</div>
				<div class="row" >
					<div class="col-lg-12">
						<h1 class="site-h1" style="border-top: 1px solid #eee;">
							通话列表<#if statusEventList??>（${statusEventList.totalElements!''}）</#if>
						</h1>
						<div class="row" style="padding:5px;">
							<div class="col-lg-12">
								<table class="layui-table" lay-skin="line">
										<thead>
											<#if statusEventList?? && statusEventList.content??&& statusEventList.content?size gt 0>
											<tr class="design-sortable-tr">
												<th>
													<input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
												</th>
												<th>主叫号码</th>
												<th>被叫号码</th>
												<th>呼叫方向</th>
												<th>拨打时间</th>
												<th>挂机时间</th>
												<th>振铃时长</th>
												<th>通话时长</th>
												<th>录音时长</th>
												<th>是否漏话</th>
												<th>是否录音</th>
												<th>坐席</th>
												<th>联系人</th>
												<th>质检结果</th>
											</tr>
											</#if>
										</thead>
										<tbody>
											<#if statusEventList?? && statusEventList.content??&& statusEventList.content?size gt 0>
											<#list statusEventList.content as history>
											<tr class="tdHasContorllor design-dropable-td">
												<td style="width:1%;">
													<input type="checkbox" class="ids" name="ids" value="${history.id!''}"/>
												</td>
												<td class="ukefu-online-client">
													<a href="/apps/callcenter/detail/index.html?id=${history.id!''}">
													${history.discaller!''}
													</a>
												</td>
												<td>
													<@secfield history.discalled!'' history.distype!''/>
												</td>
												<td>
													<#if history.calltype??>
														<#if history.calltype == 'insideline'>
															内线呼入
														<#elseif history.calltype == 'orgcallout'>
															呼出
														<#elseif history.calltype == 'insidequene'>
															内线转队列
														<#elseif history.calltype == 'insidetrans'>
															内线转接
														<#elseif history.calltype == 'outsideline'>
															外线呼入
														<#elseif history.calltype == 'outsidequene'>
															外线转队列
														<#elseif history.calltype == 'outsidetrans'>
															外线转接
														</#if>
													</#if>
												</td>
												<td class="minSize ">
													<#if history.starttime??>
														${history.starttime?string('yyyy-MM-dd HH:mm:ss')}
													</#if>
												</td>
												<td>
													<#if history.endtime??>${history.endtime?string('yyyy-MM-dd HH:mm:ss')}</#if>
												</td>
												<td>
													<#assign ringsectime = history.ringduration/1000>
													${(ringsectime/3600)?floor?string('00')}:${(ringsectime%3600/60)?floor?string('00')}:${(ringsectime%60)?floor?string('00')}
												</td>
												<td>
													<#assign sectime = history.duration/1000>
													${(sectime/3600)?floor?string('00')}:${(sectime%3600/60)?floor?string('00')}:${(sectime%60)?floor?string('00')}
												</td>
												<td>
													<#if history.recordtime??>
														<#assign recordtime = history.recordtime/1000>
														${(recordtime/3600)?floor?string('00')}:${(recordtime%3600/60)?floor?string('00')}:${(recordtime%60)?floor?string('00')}
													</#if>
												</td>
												<td>
													<#if history.misscall>
														<i class="layui-icon" style="color:#19a55d;">&#xe605;</i>
													</#if>
												</td>
												<td>
													<#if history.record>
														<i class="layui-icon" style="color:#19a55d;">&#xe605;</i>
													</#if>
												</td>
												<td>
													${history.username!''}
												</td>
												<td>
													<#if contactsList??>
														<#list contactsList.content as contacts>
															<#if contacts.id == history.dataid>${contacts.name!''}</#if>
														</#list>
													</#if>
												</td>
												<td>
													<#if history.qualityresult??>
														<#if history.qualityresult == 'pass'>
															通过
														<#elseif history.qualityresult == 'faild'>
															未通过
														</#if>
													</#if>
												</td>
											</tr>
											</#list>
											<#else>
											<div class="ukefu-empty">
												<i class="layui-icon"></i>
												<div style="">
													还没有历史通话
												</div>
											</div>
											</#if>
										</tbody>
									</table>
							</div> 	   
						</div>
						<div class="row" style="padding:5px;">
							<div class="col-lg-12" id="page" style="text-align:center;"></div>
						</div>
					</div>	
				</div>
			</div>
		</div>
	</div>
</div>
<script>
$(document).ready(function(){
	$(".menu-dropdown-a").click(function(){
		  var objpage = $(this).parent().children(".page-list") ;
		  if(objpage.css("display")=="none"){
			  objpage.show();
		  }else{
			  objpage.hide();
		  }
	  });
	$('#batexp').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#batexp').attr('href' , '/apps/contacts/expids.html?'+ids)	;
		}else{
			top.layer.alert("请先选择需要导出的联系人信息");
			$('#batexp').attr("href" , "javascript:void(0)");
		}
	});
	$('#batdel').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#batdel').attr('href' , '/apps/contacts/batdel.html?itemid=${itemid!''}&ckind=${ckind!''}&p=<#if contactsList??>${contactsList.number+1}<#else>0</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要删除的联系人信息");
			$('#batdel').attr("href" , "javascript:void(0)");
		}
	});
	$('#dischecked').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#dischecked').attr('href' , '/apps/contacts/dis.html?size=${contactsList.totalElements}<#if itemid??>&itemid=${itemid}<#elseif ckind??>&ckind=${ckind}</#if><#if filterCriteria??>&filter=${filterCriteria}</#if><#if organ??>&organ=${organ!''}</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要分配的联系人");
			$('#dischecked').attr("href" , "javascript:void(0)");
		}
	});
	$('#recyclechecked').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#recyclechecked').attr('href' , '/apps/contacts/recycle.html?size=${contactsList.totalElements}<#if itemid??>&itemid=${itemid}<#elseif ckind??>&ckind=${ckind}</#if><#if filterCriteria??>&filter=${filterCriteria}</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要回收的联系人");
			$('#recyclechecked').attr("href" , "javascript:void(0)");
		}
	});
});
layui.use(['laypage', 'layer'], function(){
	  var laypage = layui.laypage
	  ,layer = layui.layer;
	  <#if msg??>
	  top.layer.msg('${msg}');
	  </#if>
	  laypage.render({
			elem: 'page'
			,pages: <#if statusEventList??>${statusEventList.totalPages}<#else>0</#if> //总页数
			,curr:<#if statusEventList??>${statusEventList.number+1}<#else>0</#if>
			,groups: 5 //连续显示分页数
			,jump:function(data , first){
				if(!first){
					location.href = "/apps/contacts/quality/index.html?itemid=${itemid!''}&ckind=${ckind!''}&qualitystatus=${qualitystatus}&p="+data.curr
						<#if discaller?? && discaller != "" >+"&discaller=${discaller!''}"</#if>
						<#if discalled?? && discalled != "" >+"&discalled=${discalled!''}"</#if>
						<#if organ?? && organ != "" >+"&organ=${organ!''}"</#if>
						<#if userid?? && userid != "" >+"&userid=${userid!''}"</#if>
						<#if begin?? && begin != "" >+"&begin=${begin!''}"</#if>
						<#if end?? && end != "" >+"&end=${end!''}"</#if>
						
						<#if record?? && record != "" >+"&record=${record!''}"</#if>
						<#if misscall?? && misscall != "" >+"&misscall=${misscall!''}"</#if>
						<#if ringdurbegin?? && ringdurbegin != "" >+"&ringdurbegin=${ringdurbegin!''}"</#if>
						<#if ringdurend?? && ringdurend != "" >+"&ringdurend=${ringdurend!''}"</#if>
						<#if calltype?? && calltype != "" >+"&calltype=${calltype!''}"</#if>
						<#if incallbegin?? && incallbegin != "" >+"&incallbegin=${incallbegin!''}"</#if>
						<#if incallend?? && incallend != "" >+"&incallend=${incallend!''}"</#if>
						<#if recordbegin?? && recordbegin != "" >+"&recordbegin=${recordbegin!''}"</#if>
						<#if recordend?? && recordend != "" >+"&recordend=${recordend!''}"</#if>
						
						;
				}
			}
	   });
	});
</script>
